local skel = fk.CreateSkill {
  name = "rmt__xuanjiao",
  tags = {Skill.Lord},
}

local can_trigger = function(self, event, target, player, data)
  return target ~= player and player:hasSkill(skel.name) and target.kingdom == "zhao" and player.phase ~= Player.NotActive
  and data.card.type == Card.TypeBasic
end

local on_cost = function (self, event, target, player, data)
  if player.room:askToSkillInvoke(player, {skill_name =  skel.name, prompt = "#rmt__xuanjiao-invoke:"..target.id}) then
    event:setCostData(self, {tos = {target}})
    return true
  end
end

local on_use = function(self, event, target, player, data)
  player:drawCards(1, skel.name)
  if not target.dead then
    target:drawCards(1, skel.name)
  end
end

skel:addEffect(fk.CardUsing, {
  anim_type = "support",
  can_trigger = can_trigger,
  on_cost = on_cost,
  on_use = on_use,
})

skel:addEffect(fk.CardResponding, {
  anim_type = "support",
  can_trigger = can_trigger,
  on_cost = on_cost,
  on_use = on_use,
})

Fk:loadTranslationTable{
  ["rmt__xuanjiao"] = "宣教",
  [":rmt__xuanjiao"] = "主公技，其他赵势力角色于你回合内使用或打出基本牌时，你可以与其各摸一张牌。",
  ["#rmt__xuanjiao-invoke"] = "宣教：你可以与 %src 各摸一张牌。",
}

return skel
